Adjust layout, refact some codes