moved incrementer and deleted some repetitive code