Refactoring, added RSpec test`s