minor changes plus logging