It works after refactor