Imported logging to try determine cause of errors

Complementary connections: Index out of range. Not fixed yet.