Slight refactoring made