added rspec and little code clean up