update code, add rules integratio, remove variables for pa setting