Optimized parseEnv(). Fixed hangup handling. Added another test case.