code refactoring - utils