Refactoring whole code and comments