Added support for mocking and fixed issues that prevented the lib from working after minification.