Added support for custom fields
Simplified custom fields API
Removed redundant function
Small refactorings on field handling.
Added quotes for string parameters.
Merge branch 'custom_fields'