initial implementation. not tested.