Applies some refactors from the code review