Use bool statements to optimize code