Finalized validation javascript