added door logic