Added cleanup on start up and bug fix