Merge "Code cleanup in bitstream code." into experimental