Added Distance checking to remove Coredump