Updated pages code javascript