making some decent progress
almost working implementation of the python verison in haskell