Various simplifications

Localized everything- no more globals.
Simplified try/finally block
Added args, kwargs, functools.wraps
Merge pull request #3 from Lucretiel/patch-1

Various simplifications