Begin converting to more object-oriented structure

It will probably be better to use .prototype for methods.