Cleanup code, remove unused global variables

Bumped version number to 3.0