proper use of libraies 2.0, change several function names, future proof global var name, update docs