more features added to codegen

all functions properly declared apart from parameters