getCount cant be a seperate function for some reason it works if you add it directly into the submitEvent function.