Fix clang sign conversion warnings
Missing #pragma once may induce redeclaration errors
Fix clang warning: no previous prototype for function [-Wmissing-prototypes]
Cleanup, move to namespace