I fixed a bug by adding "sort" in the unions function.
I also added some code and notes in Database.cpp about interpreting rules.