Adding 'onload' function

Added an 'onload' function. Not sure it was the best way to do it but it seems to work.