Cleaned up code a bit, added key bindings for control+a and command+a.