Add zend tests for goto, refactor, optimize, fixes