Two patches for you

Let me know if you'd rather I split this in to two pull requests.