Temp rewrite
Fix consequence types
Fix all
reorganise
Remove junk
Final version
Final version