Move functions related to channels and utility functions for string handling to their own namespaces.