Few minor fixes and change of position of vars