[AM] refactoring