added pages and changed functionality