Small adjustments on javascript