Reduce if statement by returning out