JS Function corrections