functionize a bunch of stuff