Refactoring pronserve for better code reuse