refactored jquery func init