Added Documentation to the program and cleaned up some code.