fixes #1, add rspec tests