Moving debug logging to correct position.