Fix JSHint issues and missuse of console.log