Refactory layout of device stuff