Refactoring logic
Pid storadge