Performed some refactoring and documenting the modules