Some design and code style improvements