Implemented priority.

Haven't really tested it...