(unfinished) work towards porting this one to 0.6