It works! Off by one errors in preprocess fixed.