Code Refactor to avoid display issues.

Signed-off-by: Pengcheng Bian <pbian@actuate.com>