fixes some of the flaws with refactor and rspec