Refactored policy parser code