Minor code re-formatting and copy-editing
Adding documentation

Re-arranging methods in implementation