rename some vars and improve the style