src function
refactoring