Small refactors to make code a bit more readable