move detach to more appropriate area