day one of foundation dev, bringing in some stuff from joshlib rewrite from june