finish refactoring device/category