Better template logic
More fixes to round pairing algorithm