Refactoring

Typing up the code