extensive refactoring: split into multiple files in preparation for separate libraries, preparation for storing/retreiving whole channel configurations