Added feature that keeps it from crashing

and other minor edits