Refactored: add code to ignorefile