Add priorities. and refactored processing stuff
Defect reading is ready