a bit refactoring