renamed recorder to babu and get rid of comma style var declaration
separated main parts into functions to be more modular