code transposed to own js file