Add code fixes. Add base for tests
Add rspec tests. Some tiny code fixes