Added code for detecting conrner hits