maly refactor