Minimization and small fixes