Added onload function and fixed demo