Optimized JS slightly