Improved way of returning value from controller