did a bit refactoring