updated a lot
start creating new TS function