cleanup the client and move the method to protected