finish main functions of 4 pages and fix some bugs