added duplicate priority  handling
just some comments