Refactoring

Rewriting the code to conform to P&T’s coding standards