refactored smartening up of overwriting page variable