He created the template from scratch, building and revising it over and over again, until it was perfect. The whole while he was doing that, he was also perusing the compound's computer network, learning all he could about the humans and their world, and tapping into the security system to make sure he was unnoticed, and to nullify the alarms that would have alerted the humans to his presence. 