refactored everything to be more "ruby-ish"