Re-purpose cucumber calculation steps into unit tests for rspec
Fix bugs found in unit testing