refactor alert to oop