removed duplicate = and consolidated logic test