Added history file and added ability to do SELECT DISTINCT queries.
Added history file.