move device layer functionality to separate module.