implemented read_fields() function