updated controllers to return JSON