Merge flowgrind.c: Phas 1