I mean the code is nearly identical isn't it? Would it be possible to create one function to handle both cases (and perhaps have move and move_teampage as short functions that call this one function)?