refactored function name
implemented load history
added comments removed unused code