fixed the dreaded 'else if' case