mali refactor