Moved javascript to js file