refactored all until end of pp package