record function works