big update, lots of rearrangement