Added :method parameter to choose minim. algorithm