Minor refactoring + other stuff