moved global 'functions'

The global 'functions' are now defined where the class is defined.
Otherwise, they are in base (if the class is externally defined).