added global variables declaration, removed garbage files
re-added onunload for library code