changed code to detect page back to original