moved target processing to end of file