Abstracted toggleImage controller to controllers.js