exercise6A: first try - does not work really well