refactor code to make it work

Uses a class based system (sorta) in some places to let the code work
properly sue to event handlers added in from elements that the script
depends on. It's still broken, but less broken than before. Also
downgrade to 0.2 from 1.0 to make clear that this is alpha