Added logging for debugging