Create if statement to decide which code block will be used