tidying up my js