Better remainder mask generation and debugging/comenting