added actual code to variable smooth
changed res calculation in variable_smooth; not sure its right