Did a little bit of refactoring