Refactored File I/O methods into ContactDatabase class plus some housekeeping