Fixed a UI display issue and implemented template compile technique