some cleaning and position of vars