Fix a big bug of priority, some improvements. Partially checked, the reverse qnd direct things seems to work