Refactor hai->resource