Reorged code, working demo