rewrite using jquery special events