duplicate code
better with a gui example