tidy if statements, add device type to config