Refactored decription_writer method into encription_writer method by adding boolean flag