Several more fixes and some architectural planning