Cleaned up invocation building.
Added rudimentary local variables.