@pgchamberlin I wasn't sure what the code was supposed to be doing so I took a guess with these function identifiers (feel free to correct them if I mis-understood the algorithm)