Refactored minimizer code. Levmar and MultiNest are both included conditionally.