Refactoring, adding basic rspec tests