Changed scope of a few functions.