Changed channel retrieving mechanism to avoid writing to the file unnecessarily