added done port and fixed reset logic