Fixed segmentation fault; moved incrementer