implemented history function

with dubug option in TTY~