Added a clear link and moved all javascript to a separate file.