rewrote using enumerators and list of doors