Refactoring input & output TS into builder & regular TS