Added handling for optimal and existing instances