Add utility functoins to global namespace.

Move library requiremneets inside functions. There should be a
better way to do this though.