Adding method to get cavity fields. Fixed bugs.