almost done, small bugs remain