re-layouting the ts code