Export function results through stdout instead of global variables

@charlierudolph @daviscabral This change minimizes the use of global variables by making functions export their result though stdout rather than global variables.
That's another excellent idea that actually works! I have inlined these temporary variables everywhere.