corrected the '&' and '|' logic