some refactoring to genpy=tornado after discussion on google group