in this case I would rather return directly from if branches instead of introducing this generic variable