debugging
rearrange code