Modified added new method for document, minor fixes in plan class and samrt optimizer