added custom fields, fixed a few bugs