the functions bound to DOM events should be made into invokers so that they can be enacted on programatically. Also try to refactor if possible to reduce code duplication.