Moved globals to proper place
Minor cleanup
Restructured package export to be cleaner