Add test for optimization
Add debug output