Why would we panic here instead of return an error? I actually think this entire function is unneeded and should be removed.