Improved documentation along with refactoring and general clean ups.