Handles errors a bit better