could avoid the else by returning inside the first if; easier to read?