Refactoring. Step 2

Added some new methods for unloading main function and addnewvertex
function