core-5087 refactor code