Code cleanup plus re-add typescript