refactoring helpers a bit