Initialize history as specified in assignment.
Fix corner case code.