Molecular functionalization of surfaces for device applications