Add recording function