Code clean up, used BitInputStream in decode, added update method.