Major code cleanup, minor bug fixes

Deleted old or unused code & files, added comments & documentation at
the file, class, and function level. Fixed case matching for item
selection, and field previews with empty selection list.