Some refactoring from Scrutinizer results