finishing SVT algorithm