Fixed #2
Added history function; Fixed message log; Code cleanup