changes added which were suggested during code review, such as formatting, error loging, notifying the UI about errors, generalizing certificate creation