tidying up js before refactor