Updated doc and added logger for debugging.