Merge refactor back to master