explicit checking instead of using sets