Further code improvements after Scrutinizer check