refactor back to original code