Refactor block detach