Made fixes suggested by @scranfill