intermediate refactoring to sort out wrapping layer