Added a bunch of error detections / exceptions