Adding more error checking to this