Delete duplicate code
Merge pull request #1095 from mtopolnik/delete-dup

Delete duplicate code in core/main