JS Timer and limit logic