Some refactoring and added copy target