added adding page functionality and some other important functions