Cleanups based on the pull request and adding an rspec test

Adding a test case and cleaning up various things from the
pull request