javascript tidying