moveDoor function introduced.