Code Refactor

* improve readability
* clean up
* commenting