implement exists func