Unsigned annotations, attempt at datastructure optimization (doesn't work)
Fix a conditional import bug.
Replace where with maximum for speed, clean up and document algorithm.