add logging, fix formating