refactor to decrease lines number