move all code to global function BoxMover