refactor to use resque