added recording functionality