Converted to function literal

I've converted the bulk of the JoyShtick code into a function literal.
This allows instances of it to be easily created, and keeps its
variables appropriately private.