created the record function