Started refactoring
Code refactoring