top environment rewritten