insert implicit gotos
add helper functions