Devices code cleanup