Finished re-facting code with OO style.