Omg, some refactoring