link all pages together and fix some bugs