Removed duplicate javascript code