code refactoring + charts