remove trailing char
refact some variable