moved some javascript around