refactored to use checkDoorDirections