Added on dispose and changed main