changed location of functions