got optimization working