Major update

Updated to use object-oriented design. More comments about functions.