Tests for parent references and various bug fixing.