Changed scope of functions