Proc refactoring