separate JS script to external file. Simplify HTML structure
update algorithm
update CSS