Removed debug code and changed the way  __check_required_fields checks for required fields.
Made the dup and required checking methods work.