Code for sequential rounding