initial commit of working code - still needs callibration