changed several routine functions