Refactor keyboard handling into Renderer