refactor for TS v.1