this javascript should go in a separate file.