Fixed a bug that didn't process key events properly and did some
formatting.