Changed hook to $(function(){})