Intitial refactoring