Some code clean up suggested by scrutinizer