Reformatted code, and eliminated use of enums for field names (too verbose)