Object oriented

Refactored code, less heavy on update function, and less understanding
of the code is required.