Starting to rewrite the JavaScript into an OO method.