updated to use priority