changed an if...then to guards