Misc small design and bug fixes