Some functional and design fix