a bit of refactoring
constify