Move script to header and use jquery ready