Adjusted javascript