Fixed and Optimize JS