final working version, with unit tests update README with examples