Implemented shutdown handlers and provided more sonsistent agent startup behaviour (Closes #78)