reset count to zero if it gets below for some reason
added extra check to make sure certain functions were only being called once
a little js for some of the samples