First pass at #540