internal refactor