Generate code
Split elseif statements, add tests