Traeff algorithm implemented, still needs bugfixing