improvements inspired by scrutinizer