Split functions into their own namespaces

Make further development easier by splitting functions into their own
namespaces.