moved location of functions