Master refactoring

Code refactoring and more comments added