Removed globals, and made it easier for consumers