Refactored Transfer() function