refactored lua script header to be shorter, readable and editable and fixed problem with dynamic conditions and actions from config file