Refactor to be more isolated