change some logic and design