Code optimization, phasing out jquery and fixing undefined after removing timeline