Broke javascript up as appropriate