Added some documentation, did some refactoring.