DDBNEXT-409: refactor code