Aws tests

Minor refactoring and tests.
-Mark