Updated comments and cleaned up code.