Refactor and clean up data model

* References are now stored in a consistent way.
* The internal schema is now fully normalized (e.g. the
  title/label isn't duplicated to referencing objects).
Move css to a separate file
Update select2 style to look like bootstrap input fields