Slightly better error handling?