some structure and design changes