break up/rewrite core a bit