added recording code