Refactor and finished ABM-252
Refactoring and finished for ABM-249