could we refactor this, maybe ?