Refined document class, and added simple and complex tests