added moving tray logic