fixed errors and validated JS file