- Rearrange into library for Gem-ification.
- Add helper methods to make usage similar to original
  python implementation.