fixed header file separations and prints with fflush to see what is happening.
updated scripts.