Various fixes

Mostly, this is making functions calls correspond to the functions
signatures.