Refactored to fit the Ruby Style Guide