modify getInstances method to return sorted list of instances.