Move towards object oriented javascript