refactoring + other stuff