javascript fine tuning