Better handling of some edge-cases.