Simplified jquery for easier understanding.
cleanup