updated to allow passing of fields