added code found on the web