Addressing Anton's comments on PR 869.

Removed extra check for console.log() existance. Modified error
messages. Formatted entire file to fit in 80 lines or less.