adding __line__ and refactoring