Cleanup and add tests for convert_channels