clear_fields works now perfectly, some compile warnings left