Add some docstrings and fix fields_* functions.