minor style tweaks, console.log added to help debug.