Modified the design and fixed some bugs