Implemented exists function