moved row creation to its own function, fixed indentation and console.log's are now console.debug