Clear global clutter

Simplifying the api and reducing code size