new algorithm

this one is hopefully correct... :-/