Refactored functions.