Fix namespace in demo and tests, close channels, code cleanup