initial code up, needs tests and debuggin now