Add history traversal and page up/down.

Also make all defined functions run in pcall and unpack arguments.