added code for king on the middle