Algorithm #6 completed

minor fixes