Refactor the code a bit
More refactoring