Moved javascript part to a separate file