now running on multiple targets
refactored and fixed a bug for multiple tragets