merge tchan() into chan() and do some cleanups