Add temp dir to .gitignore
Remove duplicate return statement
Fix index bug that overwrites end position