Linting and removing code duplication