split script into multiple files

Cleaned the global variables.
runningEnvironment() changed to setEnvironment() and uses
object.properties instead of array.
Cleaned the way systems are defined.