First working version, with optional AMD support and examples of both AMD and non-AMD usage