refactoring, performance (more to do but this one is a good step)