Added initializing and finalizing methods. And improved docs.