finished refactoring ram ai