Make key mapping more robust against exceptions. Remove console.log messages.