removed global variables, added scripted resizing