clean-up + test for apparent bug in completion algorithm