a little rearranging

adding variables at the top, etc.