Refactor + cleanup