General cleanup, added support for meta key sequences.