Reverse priority and padId in processing sorted set
Priority is a constant (maj)
Add comments and remove ugly code