before priority function