From Objects to Agents, and Back to Smart Objects: Software Agents for Intelligent Internet of Things (IoT) Systems