Improves the encapsulation and removes references to ‘this’.

Encapsulates the library inside a function which generates a public API object. The function is evaluated and the api objects is stored in the constant.

Referencing issue #2.