minor fixes and structure changes