5 fold speed increase

Who would of guessed my shoddy logging was to blame.
Also added some more tests and comments.