Use multiple return statements instead of massive if branches