code cleanup on making dynamic document title