Add cleanup and more documenting