modified to use some jQuery