Small fixes and added rspec tests