some local modifications
fixed some merge conflicts but everything is broken, going to redesign a bit