ams refactoring