whole lotta firefox fixes and logic improvement for the environment
parsing loop
added testing and bugfixes for various browsers