can we abstract this code in a function called 'buildCheck' or something like that?