Some cleanup. Please never touch find_rect or find_corners. Thank you.