Added detach() method, as well as an example and documentation.