added corrections provided by @jebyrnes