Removes redundant debug printout.
A few style cosmetic improvements.
Clean open() flags.