Update controls.js

added code to handle the edit feature