add function to handle type of page