significant refactoring and added initial Amazon SNS support