Priority Resources are fully functional

Also rearranged some code