a bit faster decoding, cleanup