Refactored functions