Implemented shutdown call + bug fixes