revised after comments