add resque and refactoring