Add annotations for some NotNull fields, better shutdown