Adding reverse function outside the controller