Got rid of hiding flush.
Adapted logging.
-Single byte filewriting
-Freeing memory afterwards
-Debug info