tidying up js