this is a place which would benefit from a refactoring which introduces a layer object.