refactor and avoid needless redefinitions