delete unneccessary function from javascript