javascript style added. 'checkArray' function improved.