First rewrite: added PHP-populated variables."