added counter to the website, reorganizing code