Added logging for debugging purposes.