Added some documentation and cleaned some indentation.