make code easier to read, and write a rspec about it