Two pass decoding validation
Code cleanup