Function safeGridSelection