better comments for file I/O and corrected mysql connect instance