Just a small refactoring removing duplicated logic :-)