Some refactoring

Nothing important yet, just some refactoring.