Point-counting and diophantine applications