cleanup and split
Merge branch 'origin/issue-1019'