refractor into collections, models, & views, and use OrderedDict