Remove debugging statements and made the fix for selection rectangle