updating for ruby 2.0 and refactoring out long methods into shorter methods