Better way for searching element existence