Delete dead code
Tweak optimizer test for UDAs
Add checking to UDA optimizer tests