implemented the if / else if structure