remove some dev code, restructured some variables