Refactoring device

Issue #7