Added optional debug logs.