Added the necessary Javascript to make everything work