Add more logging and use formatted log statements