fixed javascript + added more variables