Better If handling.

The handling of the if's and elif's is implemented a little more
elegantly. FitAlgorithm now returns just two values (theta and phi),
which become a nan in case the fit fails.