Add core.py, converge on DRY code in master and minion