Some error corrections, code cleanup, extended file comparing