refactor and support of pf structs