modified script to add verbose logging