implemented global settings var, cleanup