Minor refactorization I made while reading the code :)