updating the removePage function