refine formula for movement of images