added logging, minor changes