replaced repeated calls to $(this) with $this