Fixed the advice to work properly. Introduced one bug but got rid of several.