Added the done signal

Added the done signal as part of the logic.