moved javascript code