Added gaurds to prevent multiple calls to done