general overhaul introducing channels instead of functions