helpers code refactoring