Multiple buttons

This is my first pull request ever so forgive me if I did something wrong.

I added support for multiple buttons and fixed up some issues with rotation, but I also changed a lot of the code, to match a style I was more comfortable with. I understand if you do not accept based on that alone, not to mention any other issues.