Pgist commands refactoring