Fixed bugs in computing over totally real fields.
Cleaned up high level functions.