refactorings + fixing inspection warnings