Refactor aws_iam to make it testable, and add some tests; fix Issue #33