Replaced and if statment