#3 refactor core