Feature/secure context vars

Slight spacing fixes to @buildmaster's pull.

Gives API access to globals, by rearranging the order in which API/globals are added to the context object.