P10 and minor refactoring