first commit of sort of working code