more complete, still unfinished jquery port