Refactor AmdLoader into a sandbox. Improve doc comments.