Added final modifier to classes and variables and null out array in finishEncode()