Working on refactoring stuff