refactor reflection utils