random stuff,extract control function. desparate into 2files