added missing namespaces, added \ for global functions

work in progress, not tested.
namespace fixes, part2
Merge pull request #1 from thejw23/master

poprawki w namespaces