Fix EnvVar regexp and clean up sources