beginning of environment and small latex related fixes