Checkin code simplified with for loops