added a bunch of foundational code

nothing tested yet