Refactoring for create targets functionality.