Replace weightNum with $weightNum