Pal refactoring 2