Added unit test, and implemented priority level.