Improved recorder script.