Initial cleanup from stupid upstream merge on my part