fixing missing variables
Fixing minor logic issues, adding spec tests, updating README with testing