Refactored the code. It works for the simple static policies