why is this series of if statements needed?