Small changes + added rspec and unit tests