Extracted if variables to make it readable