Additional error checking to help address #12