refactored function called 'target'