changes according to comments of @rrthomas