Major code reorganization.

Previous API was maintained.
Documentation now included within codebase.
Added AMD support.