Refactorized Opt. Improved opt tests.