decoding improvements, javadocs added