Cleaning up decoding in preparation for allowing k-best list output