Removed unused document reference and other cleanup