implemented the set_priority function