Mainly refactoring and nullchecks.