creating JS functionality