Fixed repositioning. Test for quality of repositioning added.