reduced the amount of else statements