added priority save function