Remove unused return value
Return early if entity is null
Indentation
Remove duplicated entity checks
Indentation
Move STOP_KEYBOARD_INPUT and remove unneeded extern