Using fetch instead of 5 line if statement