Actually use ClosureBody
Guard against a NULL environment in object mode functions.

+ some general code cleanup