Added logging, Changed code --v9.8