Refactored getting minimal plan into a method