If you just loop through these and return if the condition matches then you can get rid of the following conditional blocks and remove the indentation