implement history and up/down keys
fixed merge issues