Code cleanup and destryscript null check
Update docs