performance update and refactor