move element out of loop