split target code into file

moved target code into a separate file named target.js