General touch-ups
Fixed possible memory leak, documentation...