First refactor draft