Performance enhancement

1) Use quicker StringBuilder instead of StringBuffer for local (and, hence, thread-safe by origin) variables
2) Remove unnecessary synchronized sections from environmentSubstitute()