Documentation updated and Global variable bug fixed