refactoring in count how many doors are open method