Greatly simplified running dynamic tests first (no longer need sorting), and wrote some unit tests