Initial code

this needs quite a bit of work