Split up the tw_shared api stuff into multiple files.  Deleted unused code.