Fixed loop bug and Javascript file paths.