refactor device type