moved location of some code