improve title center on form change, remove unnecesary global variables