started moving around code in files to factor stuff.