-updated to work with newer bash versions, export in functions doesn't overwrite global defined variables