Moved javascript code