simplify alg + delete cruft
turn on some optimizations for debug mode too