Added more error checking and changed some defaults