Added Factor export and export base class.

Simplified Factor schema. Updated database schema accordingly. Code is
untested.