Refactorings, renamings and added null check