Changed int to long to prevent overflow