refactored special variable code