refactor tweet controller to incorporate passing in a function in a callback