simplified togetherjs code greatly