Refactoring and opening the listing file