Added options fields. Fixed a few bugs.