moved and fixed some logging