Fix compile errors and clean up priority a bit