Many design and bug fixes