Almost working accept function