Business logic code refactored to be more ruby-esque