Just some refactoring and cleanup