refactored a bit, updated priority regex