refactoring :(