refactored to idiomatic usage of filechannel api