integrated detach handler into mapping process