added example code showing AFactory usage