Tested a few cases successfully with indexJ - need to write QuickCheck tests next.