Refactored code

Refactored and commented code across the entire code base.
Revert "Refactored code"

This reverts commit 16a4ede5641b1a5dc72982ea5a751f4b235475eb.
Refactored code

Refactored code and commented across all code base.