Added main method for writer