Refactor following architecture discussion