hacked esmorph library to make it work with all function types
fixed end-of-function detection