mid-way refactor