fixed way the first arg of program is interpreted to make files
wrote the encode method for the class