refactor controllers to use q module