edited according to feedback