Global Functions

Moved the common functions into a globals{} table in shared.lua