Added recording function.