simplifying as per @jexp's suggestions