Bit more rearranging; trying to reduce use of inner classes for shared things (only leave inner classes for private use)