Add raising error and more documenting