Changed onClick handlers to Javascript, added some tests